<template>
  <div>
    <div>
      <div>OA系统登录</div>
    </div>
    <div>
      <div>手机号<input v-model="mobile" type="text" /></div>
      <div>手机号<input v-model="phone" type="text" /></div>
      <div>密码 <input v-model="pwd" type="text" /></div>
      <div>验证码<input v-model="code" type="text" /> <button @click="huo">
          获取图片验证码
        </button></div>
      <div>
        <el-button type="danger" >登录</el-button>
        <button @click="deng">登录</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      phone:"",
      pwd:"",
      code:""
    };
  },
  props: {},
  components: {},
  created() {},
  mounted() {},
  methods: {},
  methods: {
    huo(){
      this.$axios.get('sms/')
      .then((resp) => {
        console.log(resp)
        if (resp.data.code == 200){
          alert(resp.data.msg)
        }
      }).catch((err) => {
        console.log(err)
      });
    },
    deng(){
      this.$axios.post('login/',{'phone:':this.phone,'code':this.code,'pwd':this.pwd})
      .then((resp) => {
        console.log(resp,9999555555)
        if (resp.data.code==200){
          alert(resp.data.msg)
          localStorage.setItem('token',resp.data.token)
          this.$router.push('/home')
        }else{
          alert('登录失败')
        }
      }).catch((err) => {
        console.log(err)
      });
    },
  },
  computed: {},

  watch: {},

  directives: {},

  filters: {},
};
</script>

<style >
</style>
